package com.zhijian.medical.dao.local;

import com.zhijian.medical.entity.po.AssessmentPaperPersonResult;
import com.zhijian.medical.entity.vo.request.AssessmentPaperPersonResultSearchVo;
import com.zhijian.medical.entity.vo.response.AssessmentPaperPersonResultVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface AssessmentPaperPersonResultMapper {
    int deleteByPrimaryKey(Long id);

    /**
     * 根据试卷进行删除
     *
     * @param assessmentPaperId
     */
    void deleteByAssessmentPaperId(Long assessmentPaperId);

    /**
     * 根据考核id进行删除
     *
     * @param assessmentId
     * @return
     */
    int deleteByAssessmentId(Long assessmentId);

    /**
     * 根据试卷进行删除
     *
     * @param assessmentPaperId
     * @param userId
     */
    void deleteByAssessmentPaperIdAndUserId(@Param("assessmentPaperId") Long assessmentPaperId, @Param("userId") Long userId);

    int insert(AssessmentPaperPersonResult record);

    int insertSelective(AssessmentPaperPersonResult record);

    AssessmentPaperPersonResult selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(AssessmentPaperPersonResult record);

    int updateByPrimaryKey(AssessmentPaperPersonResult record);

    int count(AssessmentPaperPersonResultSearchVo assessmentPaperPersonResultSearchVo);

    List<AssessmentPaperPersonResultVo> selectList(AssessmentPaperPersonResultSearchVo assessmentPaperPersonResultSearchVo);

    AssessmentPaperPersonResultVo selectVoById(Long id);

    int insertBatch(@Param("entities") List<AssessmentPaperPersonResult> entities);

    /**
     * 查询一个人在一个试卷中答对题目的数量
     *
     * @param assessmentPaperId
     * @param userId
     * @return
     */
    Integer selectRightCountByAssessmentPaperIdAndUserId(@Param("assessmentPaperId") Long assessmentPaperId, @Param("userId") Long userId);

    /**
     * 查询一个人在一个试卷中，单选题，答对题目的数量
     *
     * @param assessmentPaperId
     * @param userId
     * @return
     */
    Integer selectSingleRightCountByAssessmentPaperIdAndUserId(@Param("assessmentPaperId") Long assessmentPaperId, @Param("userId") Long userId);

    /**
     * 选择某个人的某道题目的那条数据
     *
     * @param assessmentPaperId
     * @param userId
     * @param questionId
     * @return
     */
    AssessmentPaperPersonResultVo selectByAssessmentPaperIdAndUserIdAndQuestionId(@Param("assessmentPaperId") Long assessmentPaperId, @Param("userId") Long userId, @Param("questionId") Long questionId);
}